<?php
/**
 * @package pmapi
 * @copyright Copyright (c)2014 Enrico Fagnoni
 * @license GNU General Public License version 3, or later
 *
 * @since 1.0.0
 */
 
defined('_JEXEC') or die;

if (!class_exists('VirtueMartModelManufacturer')) require ( JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'manufacturer.php');

class PmapiModelManufacturer extends VirtueMartModelManufacturer 
{
    public function getItem()
    {                         
        $id = JFactory::getApplication()->input->get('id',null);
        $this->setId($id);
        $m = $this->getManufacturer();
        // Check for errors.
        if (count($errors = $this->get('Errors')) || !$m->mf_name) {
            throw new Exception(implode("\n", $errors)||'Not Found', 404);
        }
        
        $this->addImages($m);
        
        return (object) get_object_vars($m);
    }

}
